vcWorld

World is the root node of the simulation. It provides access to the layout items, components, groups and views.

See in: Overview

Module: vcCore

Parent: vcLayout

Children -

Referenced by: vcBehavior.World, vcCore.getWorld(), vcNode.World, vcWorldManager.ActiveWorld, ... (see more)
vcBehavior.World
vcCore.getWorld()
vcNode.World
vcWorldManager.ActiveWorld
vcWorldManager.StaticDrawingWorld
vcWorldManager.StaticSimWorld

Properties

Learn how to use properties here. The properties are also inherited from the parent class.

NameTypeAccessDescription
BehaviorsvcList[vcBehavior]RGets a list of all behaviors in the world.
CollisionManagervcCollisionManagerRGets collision manager instance that is used to listen to collision events from existing collision detectors in this vcWorld.
ComponentsvcObservableList[vcComponent]RGets a list of all components in the 3D world.
FocusModeManagervcFocusModeManagerRGets focus mode manager instance that is used to control focus mode feature for this vcWorld.
LayoutItemsvcList[vcLayoutItem]RGets a list of all layout items in the current layout.
LayoutModifiedBooleanRWGets or sets if the current layout has been modified since it was loaded or its last save.
See more
LayoutModified acts as a flag for determining if you are prompted to save a layout and the current state of the Save command.

The value is set to True when a user makes a change to the current layout using the GUI.

A script that makes changes to a layout should set the value to True in order for the application to know whether or not the layout needs to be saved.This is not needed if the script only makes temporary changes to a layout during a simulation.
LayoutUriStringRGets the URI of current layout.
LayoutsvcList[vcLayout]RGets a list of all layouts in the world.
LightsvcList[vcLight]RGets a list of all lights in the 3D world.
ProcessControllervcProcessControllerRGets the process controller.
StatisticsManagervcStatisticsManagerRGets the statistics manager of simulation used for defining intervals for all statistics behaviors.
ViewsvcList[vcView]RGets a list of all views in the current layout.

Methods

Learn how to use methods here. The methods are also inherited from the parent class.

NameReturn TypeParametersDescription
clearNoneNoneRemoves all components from the 3D world.
See more
Exceptions:
RuntimeError: When called from a script that is not python command.
RuntimeError: When world's hierarchy is locked.
connectComponentsBooleanvcComponent fromComponent,
vcComponent toComponent
Connects all matching physical interfaces between two given components.
See more
If a physical connection requires repositioning then toComponent is snapped to fromComponent.
If a connection forms a parent-child hierarchy, the child component is moved and attached to the parent component.

Parameters:
fromComponent (vcComponent): Component to connect from.
toComponent (vcComponent): Component to connect to.

Returns:
bool: True when matching interfaces were found in the components. True doesn't necessarily mean that any interfaces got connected.
createBehaviorNoneNoneAdding behaviors to the world root node is not supported..

Exceptions:
RuntimeError: Always.
createComponentvcComponentOptional Keyword[name = String]Creates a new component at the 3D world origin.
See more
Parameters:
Optional: name (str): Name for the new component. When not provided, an auto-generated name will be given.

Exceptions:
ValueError: When given component name is not unique.

Returns:
vcComponent: The newly created component.
createLayoutItemvcLayoutItemvcLayoutItemType typeCreates a new layout item of a given type in the current layout.
See more
Parameters:
type (str): item type to create

Returns:
vcLayoutItem: The newly created layout item.

Exceptions:
RuntimeError: When specific value type does not exists.
RuntimeError: When trying to create annotation, dimension or drawing item without license for Drawing API.
createLightvcLightvcLightType typeCreates a new light with a given type which is attached to the 3D world.
See more
Parameters:
type (vcLightType): Light type.

Returns:
vcLight: Light.
createViewvcViewString nameCreates a new view of a given name based on the current 3D world view.
See more
The view itself is saved with a layout and listed as a User View in the GUI whenever the layout is loaded in the 3D world.

Parameters:
name (str): View name.

Returns:
vcView: View.
createVolumeDetectorvcVolumeDetectorNoneCreates a new volume detector into this world.

Returns:
vcVolumeDetector: Created volume detector.
deleteNoneNoneDeletes world node
See more
Exceptions:
RuntimeError: When Parent node is null.
RuntimeError: When world node is a system world.
RuntimeError: When there is no license for Modeling API.
deleteViewNonevcView viewDeletes the provided view from the current layout.

Parameters:
view (vcView): View.
findCameravcCameraOptional Keyword[name = String]Returns a camera used by the application in an environment.
See more
An optional name argument can be given to find a specific camera; otherwise the method returns the first found camera.

If no camera is found, returns None.

Parameters:
Optional: name (str): Camera name.

Returns:
vcCamera: Camera.
findComponentvcComponentString nameFinds the component matching a given name.
See more
Parameters:
name (str): Component's name.

Returns:
vcComponent: Returns the found component. If no match is found, returns None.
findLayoutItemvcLayoutItemOptional Keyword[name = String]Returns a layout item that matches a given name in current layout.
See more
Parameters:
name (str): item type to name

Returns:
vcLayoutItem: The found layout item. If nothing was found, returns None.
findLightvcLightOptional Keyword[name = String]Returns the first found light in the 3D world or a light matching a given name.
See more
If no light is found with the given name, returns None.

Parameters:
Optional: name (str): Light name.

Returns:
vcLight: Light.
findViewvcViewString nameReturns a view matching a given name in the current layout; otherwise returns None.

Parameters:
name (str): View name.

Returns:
vcView: View.
getFeatureNoneNoneFeatures directly on the 3D world are not supported.

Returns:
None.
useViewNonevcView view,
Optional Keyword[time = Real]
Switches the view of the 3D world to the provided view.

An optional time argument can be given to interpolate the linear movement of the camera to new view. That is, a timed camera movement (in seconds).
See more
Parameters:
view (vcView): View.
Optional: time (float): Interpolation time in seconds.

Events

Learn how to use events here. The events are also inherited from the parent class.

NameParametersDescription
OnDynamicComponentNoneTriggered when a component is created in 3D world during a simulation.
See more
For static components, use the events from the list you get from the property Components.

Parameters:
component(vcComponent) : The component that was added or removed.
added(bool) : True if the component was added, false if it was removed.

Example: Find Component From World

"""Finding a component is done via vcWorld in py3 api.
This example shows how to find a component by its name in the world.
"""

import vcCore as vc

world = vc.getWorld()
found_comp = world.findComponent("MyCustomComponent")
print (found_comp.Name)